package org.tong.activiti6.listeners;

import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.springframework.stereotype.Component;


@Component
public class MyActivitListener implements ActivitiEventListener {
    @Override
    public void onEvent(ActivitiEvent activitiEvent) {
        StringBuilder sb = new StringBuilder();
        sb.append("type:").append(activitiEvent.getType().name()).append("\n")
                .append("procDefId:").append(activitiEvent.getProcessDefinitionId()).append("\n")
                .append("procId:").append(activitiEvent.getProcessInstanceId()).append("\n")
                .append("executeId:").append(activitiEvent.getExecutionId()).append("\n")
                .append("class:").append(activitiEvent.getClass().getCanonicalName()).append("\n");
        System.err.println(sb.toString());
    }

    @Override
    public boolean isFailOnException() {
        return false;
    }
}
